

#import "BSUtils.h"
#import "BSCommon.h"

@implementation BSUtils


+ (NSString *)systemName {
    return [[UIDevice currentDevice]systemName];
}
+ (NSString *)systemVersion {
    return [[UIDevice currentDevice]systemVersion];
}

+ (NSString *)convertToJsonData:(NSDictionary *)dict {
    NSError *error;
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dict options:NSJSONWritingPrettyPrinted error:&error];
    NSString *jsonString;
    if (!jsonData) {
        NSLog(@"%@",error);
    }else{
        jsonString = [[NSString alloc]initWithData:jsonData encoding:NSUTF8StringEncoding];
    }
    return jsonString;
}

+ (NSDate *)formatToDate:(NSString *)strDate {
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    [dateFormatter setTimeZone:[NSTimeZone systemTimeZone]];
    return [[dateFormatter dateFromString:strDate]dateByAddingTimeInterval:60*60*8];
}

@end
